package com.tanhua.server.controller;


import com.tanhua.server.service.SoulService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;
import java.util.Map;

@RestController
@RequestMapping("/testSoul")
public class SoulController {

    @Autowired
    private SoulService soulService;

    /**
     * 查询所需要的问卷列表
     * @return
     */
    @GetMapping
    public Object findQuestionQueue(){
      return this.soulService.findQuestionQueue();
    }

    /**
     * 提交问卷
     * @param map
     * @return
     */
    @PostMapping
    public Object testSoul(@RequestBody Map<String,Object> map){
        Object answers =map.get("answers");
        return this.soulService.questionPost(answers);
    }

    /**
     * 查看结果
     * @param soulId
     * @return
     */
    @GetMapping("/report/{id}")
    public Object findReport(@PathVariable("id")String soulId){
        return soulService.findReport(soulId);
    }
}
